package com.shijie99.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.shijie99.demo.pojo.ConfigUser;
import com.shijie99.demo.service.UserService;

@RestController
@RequestMapping("/rest")
public class MyRestController {
	@Autowired
	UserService userService;
	
	@RequestMapping("/test/{mode}")
	public String rest(@PathVariable("mode") String mode) {
		int modeInt = Integer.parseInt(mode);
		if(modeInt == 0) {
		ConfigUser user = userService.test();
			return JSONObject.toJSONString(user);
		} else {
			return String.valueOf(userService.test1());
		}
	}
}
